<template>
    <el-button class="reset-btn" icon="Refresh" @click="resetSearch"></el-button>
</template>

<script setup>


  const props = defineProps({
    // 数据
    queryParams: {
      type: Object,
      default: null,
    },
  });
  const emit = defineEmits(['reset']);

  const resetSearch = () => {
    const data = props.queryParams;
    if (data) {
      for (const key in data) {
        if (key == "pageNum"||key=='page') {
          data[key] = 1;
        } else if (key == "pageSize") {
          data[key] = 20;
        } else {
          data[key] = null;
        }

      }
    }
    // 重置搜索条件
    emit('reset',data);
  }


</script>

<style scoped lang="scss">
.reset-btn{
  margin-right: 6px;
  margin-left:2px;
  padding: 5px 14px;
}
</style>